import { request } from "@/utils/service"
import type * as Combo from "./types/combo"
import { getToken } from "@/utils/cache/cookies"
/** 增 */
export function createComboDataApi(data: Combo.ICreateComboRequestData) {
  return request({
    url: "order/packageBackup/add",
    method: "post",
    data
  })
}

/** 删 */
export function deleteComboDataApi(id: string) {
  return request({
    url: "order/packageBackup/del",
    method: "delete",
    params: {
      id
    }
  })
}

/** 改 */
export function updateComboDataApi(data: Combo.ICreateComboRequestData) {
  return request({
    url: "order/packageBackup/update",
    method: "put",
    data
  })
}

/** 查 */
export function getComboDataApi(params: Combo.IGetComboRequestData) {
  return request<any>({
    url: "order/packageBackup/query",
    method: "get",
    params
  })
}
/** 上下架 */
export function upOrDwon(data: any) {
  return request({
    url: "/order/packageBackup/updateStatus",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

/**图片上传 */
export function uploadComboImageList(data: any) {
  return request({
    url: "order/package/upload",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

//创建二维码弹窗
export function createEwmPop(data: any) {
  return request({
    url: "/h5/uploadPictures",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

/** 查 */
export function getEwmUrl(params: any) {
  return request<any>({
    url: "/h5/queryPicture",
    method: "get",
    params
  })
}

/**自定义分享链接 */
export function createShareDIYLink(data: any) {
  return request({
    url: "order/h5UrlLog/add",
    method: "post",
    data
  })
}

export function getShareDIYLink(params: any) {
  return request({
    url: "order/h5UrlLog/query",
    method: "get",
    params
  })
}
/**套餐合集相关 */
/** 增 */
export function createCollectionDataApi(data: any) {
  return request({
    url: "/h5/packHe/add",
    method: "post",
    data
  })
}
/** 克隆 */
export function cloenCollectionDataApi(data: any) {
  return request({
    url: "/h5/packHe/copy",
    method: "post",
    headers: {
      "Content-Type": "multipart/form-data",
      token: getToken()
    },
    data
  })
}

/** 删 */
export function deleteCollectionDataApi(id: string) {
  return request({
    url: "/h5/packHe/del",
    method: "delete",
    params: {
      id
    }
  })
}

/** 改 */
export function updateCollectionDataApi(data: any) {
  return request({
    url: "/h5/packHe/update",
    method: "put",
    data
  })
}

/** 查 */
export function getCollectionDataApi(params: any) {
  return request<any>({
    url: "/h5/packHe/query",
    method: "get",
    params
  })
}
/**套餐合集子套餐相关 */
/** 增 */
export function createCollectionChild(data: any) {
  return request({
    url: "/h5/packHeInfo/add",
    method: "post",
    data
  })
}

/** 删 */
export function deleteCollectionChild(id: string) {
  return request({
    url: "/h5/packHeInfo/del",
    method: "delete",
    params: {
      id
    }
  })
}

/** 改 */
export function updateCollectionChild(data: any) {
  return request({
    url: "/h5/packHeInfo/update",
    method: "put",
    data
  })
}

/** 查 */
export function getCollectionChild(params: any) {
  return request<any>({
    url: "/h5/packHeInfo/query",
    method: "get",
    params
  })
}

/**h5合集页移动端 */
export function getCollectionH5List(params: any) {
  return request<any>({
    url: "/h5/packHe/queryInfo",
    method: "get",
    params
  })
}
/**h5合集批量配置 */
export function createCollectionChilds(data: any) {
  return request({
    url: "/h5/packHe/plAdd",
    method: "post",
    data
  })
}
